<template>
  <mavon-editor
    class="editor"
    :value="content"
    :ishljs="true"
    :boxShadow="false"
    :defaultOpen="edit"
    placeholder="请输入内容"
    previewBackground="#fff"
    @change="change"
    :subfield="isEdit"
    :editable="isEdit"
    :toolbarsFlag="isEdit"
  />
</template>

<script>
import { mavonEditor } from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
export default {
  components: {
    mavonEditor
  },
  props: {
    content: {
      type: String
    },
    isEdit: {
      type: Boolean,
      default: true
    },
    edit: {
      type: String,
      default: 'edit'
    },
    render: {
      type: String,
      default: 'value'
    }
  },
  methods: {
    change (value, render) {
      if (this.render === 'render') {
        this.$emit('update:content', render)
      } else if (this.render === 'value') {
        this.$emit('update:content', value)
      }
    }
  }
}
</script>

<style>

</style>